<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-yellow sidebar-mini">
<section class="content-header">
    <div id="toolbar" class="form-inline">
        <a id="btn_notRead"  href="javascript:void(0);"
           class="btn btn-success pull-right" style="margin-right: 10px" onclick="saveAll()">
            <span class="Bold">保存</span>
        </a>
    </div>
    <h1></h1>
</section>
<section class="content">
    <div class="col-xs-10 col-xs-offset-1" style="font-size: 14px;line-height: 200%;">
        <img th:src="@{/img/logo3.jpg}" width="100px" height="100px" style="margin-top: -30px">
        <div style="display: inline-block;margin-top: 5px;margin-left: 60px;font-size: 30px" align="center">
            <span style="letter-spacing: 24px;display: block;line-height: 60px">&nbsp;辽宁忠旺机械设备制造有限公司</span>
            <span style="display: block;font-size: 20px;line-height: 30px;">Liaoning Zhongwang Machinery Equipment Manufacturing Co., Ltd</span>
        </div>
        <div class="col-xs-10 col-xs-offset-1"
             style="display: inline-block;margin-top: 5px;margin-left: 60px;font-size: 40px" align="center">
            <span style="letter-spacing: 24px;display: block;line-height: 60px">&nbsp;安装派工单</span>
        </div>
    </div>
    <div class="box-body">
        <form id="sheetForm" class="form-horizontal bg-white">
            <div class="col-md-6 col-xs-offset-1">
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">生产订单编号</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="prodNo" type="text" class="form-control"/>
                    </label>
                </div>
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">项目编号</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <select id="sheetForm-proCode" style="width:300px" class="form-control"
                                name="proCode"></select>
                    </label>
                </div>
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">需方</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="customer" type="text" class="form-control" id="sheetForm-customer" readonly="readonly"/>
                    </label>
                </div>
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">安装数量</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="installNum" type="number" class="form-control" />
                    </label>
                </div>
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">设计负责人及联系方式</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="designLeader" type="text" class="form-control" />
                    </label>
                </div>
                <div class="col-md-12 form-group ">
                    <label class="control-label"
                           style="text-align: left;width:100px;padding-right: 0px;padding-left: 10px;">安装需求</label>
                    <label class="control-label" col-md-8 style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="installationRequirements" type="text" class="form-control" />
                    </label>
                </div>
            </div>

            <div class="col-md-4">
                <div class="col-md-12 form-group">
                    <label class="control-label"
                           style="text-align: left;width:90px;padding-right: 0px;padding-left: 10px;">订单数量</label>
                    <label class="control-label" style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="prodNum" type="text" class="form-control" id="sheetForm-proNum" readonly="readonly"/>
                    </label>
                </div>
                <div class="col-md-12 form-group">
                    <label class="control-label"
                           style="text-align: left;width:90px;padding-right: 0px;padding-left: 10px;">项目名称</label>
                    <label class="control-label" style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="proName" type="text" class="form-control" id="sheetForm-proName" readonly="readonly"/>
                    </label>
                </div>
                <div class="col-md-12 form-group">
                    <label class="control-label"
                           style="text-align: left;width:90px;padding-right: 0px;padding-left: 10px;">安装地点</label>
                    <label class="control-label" style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="installPlace" type="text" class="form-control" />
                    </label>
                </div>
                <div class="col-md-12 form-group">
                    <label class="control-label"
                           style="text-align: left;width:90px;padding-right: 0px;padding-left: 10px;">项目负责人及联系方式</label>
                    <label class="control-label" style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="projectLeader" type="text" class="form-control" />
                    </label>
                </div>
                <div class="col-md-12 form-group">
                    <label class="control-label"
                           style="text-align: left;width:90px;padding-right: 0px;padding-left: 10px;">出厂编号</label>
                    <label class="control-label" style="text-align: left;padding-left: 5px;">
                        <input style="width: 300px" name="factoryNumber" type="text" class="form-control" />
                    </label>
                </div>
            </div>
            <div class="col-xs-10 col-xs-offset-1">
                <table class="t1" id="hoursTable">
                    <thead>
                    <tr>
                        <td style="width: 10%">类型</td>
                        <td style="width: 23%">安装负责人</td>
                        <td style="width: 16%">要求完成日期</td>
                        <td style="width: 10%">是否调试</td>
                        <td style="width: 25%">备注</td>
                    </tr>
                    </thead>
                    <tbody >
                    <tr >
                        <td>
                            <input type="text" class="form-control" name="special" autocomplete="off" value="机械" readonly>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installPrincipal" autocomplete="off">
                        </td>
                        <td>
                            <input type="text" class="form-control datepicker" name="installTime"
                                   readonly="readonly" style="width: 100%;"/>
                        </td>
                        <td>
                            <select  class="form-control" name="isDebugging">
                                <option value="" selected>请选择</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                            </select>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installRemark" autocomplete="off">
                        </td>
                    </tr>
                    <tr >
                        <td>
                            <input type="text" class="form-control" name="special" autocomplete="off" value="流体" readonly>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installPrincipal" autocomplete="off">
                        </td>
                        <td>
                            <input type="text" class="form-control datepicker" name="installTime"
                                   readonly="readonly" style="width: 100%;"/>
                        </td>
                        <td>
                            <select  class="form-control" name="isDebugging">
                                <option value="" selected>请选择</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                            </select>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installRemark" autocomplete="off">
                        </td>
                    </tr>
                    <tr >
                        <td>
                            <input type="text" class="form-control" name="special" autocomplete="off" value="自动化" readonly>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installPrincipal" autocomplete="off">
                        </td>
                        <td>
                            <input type="text" class="form-control datepicker" name="installTime"
                                   readonly="readonly" style="width: 100%;"/>
                        </td>
                        <td>
                            <select  class="form-control" name="isDebugging">
                                <option value="" selected>请选择</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                            </select>
                        </td>
                        <td>
                            <input type="text" class="form-control" name="installRemark" autocomplete="off">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </form>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let table, table1, table2;
    /**添加明细选择按钮*/
    js.select2({
        id: 'sheetForm-proCode',
        placeholder: '',
        ajax: {

            url: function () {
                return ctx + 'create/shipments/project/list'
            },
            processResults: function (data, page) {
                let array = data;
                for (let i = 0; i < data.length; i++) {
                    array[i]["proId"] = array[i]['proId'];
                    array[i]["id"] = array[i]['proCode'];
                    array[i]["text"] = array[i]['proCode'];

                }
                return {results: array};
            },
        }
    });
    /** 项目编号下拉框选中 */
    $("#sheetForm-proCode").on("select2:select", function () {
        $("#sheetForm-proName").val($(this).select2("data")[0].proName);
        $("#sheetForm-customer").val($(this).select2("data")[0].customer);
        $("#proId").val($(this).select2("data")[0].proId);
        $("#sheetForm-proCode").val($(this).select2("data")[0].proCode);
        $("#sheetForm-proNum").val($(this).select2("data")[0].proQty);
    });

    /** 批量提交 */
    function saveAll() {
        let res = js.vd({
            id: 'sheetForm',
            notEmpty: ['prodNo', 'proCode', 'installNum', 'designLeader', 'installationRequirements','installPlace'
                , 'projectLeader', 'factoryNumber', 'installPrincipal', 'installTime','isDebugging']
        })
        if (!res) {
            return;
        }
        var url = ctx + "create/dispatching/addDispatching";
        js.validSubmit({
            formId: "sheetForm",
            url: url,
            data: new FormData($("#sheetForm")[0]),
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }
    $(function () {

    });

</script>
</body>
</html>